<?php
class log_adik_asuh extends MY_Controller{
    function log_adik_asuh(){
        parent::MY_Controller();
        $this->data['title'] = "Input Log Adik Asuh";
        $this->load->model('m_log_adik_asuh');
        $this->load->model('m_member');
    }
    
    function index(){
        $idMember = $this->session->userdata('id_member');
        $this->data['dataMember'] = $this->m_member->getMemberById($idMember);
        $this->data['content'] = "log_adik_asuh/v_log_adik_asuh";
        $this->data['formTitle'] = "Form Log Adik Asuh";
        $this->data['subLink'] = "log_adik_asuh/add_log_adik_asuh_proses";
        $this->render($this->data);
    }
    function add_log_adik_asuh_proses(){
        $data = array('tanggal' => date2mysql($this->input->post('tanggal')),
            'id_member' => $this->input->post('idMember'),
            'id_adik_asuh' => $this->input->post('idAdikAsuh'),
            'id_sekolah' => $this->input->post('idSekolah'),
            'id_kelas' => $this->input->post('idKelas'),
            'id_tahun_ajaran' => $this->input->post('idTahunAjaran'),
            'komentar' => $this->input->post('komentar'));
        $insert = $this->m_log_adik_asuh->add_log_adik_asuh($data);
        if($insert == TRUE){
            $this->session->set_flashdata("message",1);
        }else{
            $this->session->set_flashdata("message",2);
        }
        
        redirect('log_adik_asuh');
    }
}
?>
